<?php
date_default_timezone_set('America/Montreal');
define("VERSION", "0.0.1.10001");
define("TITLE", "SpotDriver Web");

error_reporting(-1);
ini_set('display_errors', 1);

include("Session.php");
include("SpotifyWebAPI.php");
include("SpotifyWebAPIException.php");


$session = new Session(
    '78bed64849d944b995b022f4d49e6b69',
    '7972affa3dd840a79b299663f1ed57e8',
    'http://www.touzel.com/dev/result.php'
);

$api = new SpotifyWebAPI();
$scopes = array(
    'playlist-read-private',
    'user-read-private',
    'user-library-read'
);

$authorizeUrl = $session->getAuthorizeUrl(array(
    'scope' => $scopes
));

header('Location: ' . $authorizeUrl);
die();

//$session->requestAccessToken($_GET['code']);

//if (isset($_GET['code'])) {
//    $session->requestAccessToken($_GET['code']);
//    $api->setAccessToken($session->getAccessToken());

//    print_r($api->me());
//} else {

//    header('Location: ' . $session->getAuthorizeUrl($scopes));

?>

